package com.ihg.hiex.entity.user;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.ihg.hiex.entity.session.Session;

/**
 * 用户熟悉程度关系表
 * 
 * @author mohanlan
 */
@Entity
@Table(name = "knowing_relation")
public class KnowingRelation {
    
    @Id
    @GeneratedValue
    private Long id;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private Assessor assessor;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private Delegate delegate;
    
    /** 所属session */
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private Session session;
    
    /** 熟悉程度 */
    @Enumerated(EnumType.ORDINAL)
    private KnowingLevel knowingLevel;
    
    private Date createTime;
    
    private Date lastModifyTime;
    
    private Long lastOperator;
    
    @Column(name = "is_disabled")
    private boolean disabled;
    
    /**
     * The default constructor
     */
    public KnowingRelation() {
    }
    
    /**
     * @param session
     * @param assessor
     * @param delegate
     * @param knowingLevel
     */
    public KnowingRelation(Session session, Assessor assessor, Delegate delegate, KnowingLevel knowingLevel) {
        this.session = session;
        this.assessor = assessor;
        this.delegate = delegate;
        this.knowingLevel = knowingLevel;
        this.createTime = new Date();
        this.lastModifyTime = createTime;
    }
    
    /**
     * @param knowingLevel
     * @return
     */
    public KnowingRelation editKnowLevel(KnowingLevel knowingLevel) {
        this.knowingLevel = knowingLevel;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the assessor
     */
    public Assessor getAssessor() {
        return assessor;
    }

    /**
     * @return the delegate
     */
    public Delegate getDelegate() {
        return delegate;
    }

    /**
     * @return the session
     */
    public Session getSession() {
        return session;
    }

    /**
     * @return the knowingLevel
     */
    public KnowingLevel getKnowingLevel() {
        return knowingLevel;
    }

    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * @return the lastModifyTime
     */
    public Date getLastModifyTime() {
        return lastModifyTime;
    }

    /**
     * @return the lastOperator
     */
    public Long getLastOperator() {
        return lastOperator;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param assessor the assessor to set
     */
    public void setAssessor(Assessor assessor) {
        this.assessor = assessor;
    }

    /**
     * @param delegate the delegate to set
     */
    public void setDelegate(Delegate delegate) {
        this.delegate = delegate;
    }

    /**
     * @param session the session to set
     */
    public void setSession(Session session) {
        this.session = session;
    }

    /**
     * @param knowingLevel the knowingLevel to set
     */
    public void setKnowingLevel(KnowingLevel knowingLevel) {
        this.knowingLevel = knowingLevel;
    }

    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @param lastModifyTime the lastModifyTime to set
     */
    public void setLastModifyTime(Date lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    /**
     * @param lastOperator the lastOperator to set
     */
    public void setLastOperator(Long lastOperator) {
        this.lastOperator = lastOperator;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }
    
}